// xc/components/diy/coupon/getcoupon.js
var html2wxml = require('../../../../html2wxml/html2wxml.js');
var coupon_cont = require('../../../model/coupon_cont')
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    isshow: false,
    model: null,
    xtitle: "领取优惠券"
  },

  /**
   * 组件的方法列表
   */
  methods: {
    closefunc() {
      this.setData({
        isshow: false
      })
    },
    receivecoupon(ev) {
      var item = this.data.model

      var that = this
   
   

     
        coupon_cont.receivecoupon(item.id).then(res => {
          that.triggerEvent("receivecouponchange", res);
          that.closefunc()
        })

    },
    showmodel(model) {



      html2wxml.html2wxml('article', model.remark, this, 5);
      var updatemodel = {
        isshow: true,
        model
      }
      this.setData(updatemodel)

    }
  }
})